package com.igeek.javase.ch02;

import java.util.Scanner;

/*
 *@author wangpeng
 *2023/7/11 18:58
 *@description 打印金字塔图案
 */
public class ForTest2 {
        public static void main(String[] args) {
            Scanner row = new Scanner(System.in);
            System.out.println("打印金字塔，请输入需要打印的行数n：\n");
            int n = row.nextInt();
            for (int i = 1; i <= n; i++) {
                for (int k = 0; k < n - i; k++) {
                    System.out.print(" ");
                }
                for (int m = 0; m < 2 * i - 1; m++) {
                    System.out.print("*");
                }
                System.out.println();
            }
        }
}


